import * as z from 'zod';
import { NextRequest, NextResponse } from "next/server";

export interface BaseResponse {
    code: number;
    msg: string;
    data: any;
}

/**
 * 返回的枚举
 */
export enum ResponseEnum {
    success = 200, fail = 400, unauthorized = 401, error = 500
}

/**
 * 返回格式
 * @param code
 * @param msg
 * @param data
 * @constructor
 */
export const GloableResponseItem = (code: ResponseEnum = ResponseEnum.success, msg: String = "", data: object | null) => {
    return NextResponse.json({
        code: code, msg: msg, data: data
    })
}